<!DOCTYPE html>
<title>masterResultsTest</title>
<meta charset="utf-8">
<script src="/test/som-test-results/test-data.js"></script>
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="/bower_components/web-component-tester/browser.js"></script>
<link rel="import" href="/elements/som-test-results/som-master-results.html">
<test-fixture id="som-master-results-test">
  <template>
    <som-master-results></som-master-results>
  </template>
</test-fixture>

<script>
  'use strict';

  suite('som-master-results', function() {
    var element;
    setup(function() {
      element = fixture('som-master-results-test');
      element.masterResults = {
        master_name: 'some-master',
        builder_results: [builderOne, builderTwo, builderThree],
      };
    });

    test('test expansion', function(done) {

      flush(function() {
        assert.isTrue(element.masterIsCollapsed)
        assert.equal(builderOne, element._getFirstResults(element.masterResults));
        assert.deepEqual(
            [builderTwo, builderThree],
            element._getAdditionalResults(element.masterResults));
        assert.equal(
            'expand-more', element._computeExpandIcon(element.masterIsCollapsed));

        element._toggleExpand();
        assert.isFalse(element.masterIsCollapsed)
        assert.equal(
            'expand-less',
            element._computeExpandIcon(element.masterIsCollapsed));

        element._toggleExpand();
        assert.isTrue(element.masterIsCollapsed)
        assert.equal(
            'expand-more', element._computeExpandIcon(element.masterIsCollapsed));

        done();
      });
    });
  });

</script>
